import { request } from "umi";

/** 获取等级信息列表 */
export async function getLevelList({ current, pageSize }: Partial<COMMON.PageParams>) {
  return request<COMMON.PageResult<PATIENT.LevelInfo>>(`/api/patient/rank/${current}/limit/${pageSize}`, {
  });
}

/** 新增等级信息 */
export async function addLevelInfo(data: Partial<PATIENT.LevelInfo>) {
  return request<PATIENT.LevelInfo>(`/api/patient/rank/info`, {
    method: 'POST',
    data,
    headers: {
      Action_Id: '900901016'
    }
  });
}

/** 修改等级信息 */
export async function editLevelInfo({ rank_id, ...data }: Partial<PATIENT.LevelInfo>) {
  return request(`/api/patient/rank/${rank_id}`, {
    method: 'PATCH',
    data,
    headers: {
      Action_Id: '900901017'
    }
  });
}

/** 删除等级信息 */
export async function deleteLevelInfo(rank_id: string) {
  return request(`/api/patient/rank/${rank_id}`, {
    method: 'DELETE',
    headers: {
      Action_Id: '900901018'
    }
  });
}

/** 获取用户等级信息 */
export async function getPatientLevelInfo(patient_id: string) {
  return request(`/api/patient/rank/patient/${patient_id}`);
}
